from common.database import db


class User(db.Model):
    __tablename__ = 'user'
    id = db.Column(db.String, primary_key=True)
    name = db.Column(db.String)
    email = db.Column(db.String)
    password = db.Column(db.String)
    register_time = db.Column(db.DateTime)
    # children = db.relationship('detect_result', backref='user', lazy=True)

    def to_dict(self):
        return {
            'id': self.id,
            'name': self.name,
            'email': self.email,
            'register_time': self.register_time
        }
